<?php
require_once ($_SERVER['DOCUMENT_ROOT'].'/conf/global.config.php');
require_once (SRC_DIR.'util.php');

$urldata = urldecode($_SERVER['QUERY_STRING']);

$pos = strpos($urldata, '{');
if ($pos)
{
    $urldata =  substr($urldata,0,$pos);//客户端请求带arg格式，去掉后面的json  plat=android{"server_id"："1"}
}

parse_str($urldata, $data);
if (!isset($data['uid'],$data['amount'],$data['orderid'],$data['server_id'], $data['count'], $data['token']))
{
  ExitAndLog("-1");
}

$rate = 10;//元宝比例
if ($data['amount']*$rate != $data['count'])
  ExitAndLog("-2");


$result = array("ret" => 0,);
echo json_encode($result);

function ExitAndLog($msg)
{
    global $urldata;
    Util::Logger("urldata:$urldata","yiyou_pay_verify");
    
    $result = array(
        "ret" => $msg
    );
    exit(json_encode($result));
}